/*
 * Packing.java 2012-8-21
 * Copyright(c) 20012-2015 by covidien
 * ALL Rights Reserved.
 */
package com.mvc.business.model;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.mvc.ProjectUtils;
import com.mvc.base.model.BaseCompany;
import com.mvc.base.model.Customer;

/**
 * 
 * @author Bob pu
 * @version V1.0 Create Time: 2012-8-21
 */
@Entity(name = "B_PACKING")
public class Packing extends BaseCompany {

	public static final int	  STATUS_CREATED	= 1;
	public static final int	  STATUS_HANDLED	= 10;

	@NotNull
	private Integer	          customerId;
	@NotNull
	@Length(max = 32)
	private String	          blNo;
	@NotNull
	private Date	          packingDate;

	private Integer	          commercialInvoiceId;
	@Length(max = 2048)
	private String	          remark;
	@NotNull
	private Integer	          type;
	@Length(max = 32)
	private String	          byOthers;
	@NotNull
	@Length(max = 64)
	private String	          shipName;
	@NotNull
	private Date	          eta;

	@NotNull
	private Integer	          status;
	@Length(max = 64)
	private String	          sealNo;
	@Length(max = 64)
	private String	          containerNo;

	@Transient
	private List<PackingItem>	packingItems;
	@Transient
	private Customer	      customer;
	@Transient
	private String	          orderIds;

	private Double	          totalQuantity;
	private Integer	          totalPackages;
	private Double	          totalNetWeight;
	private Double	          totalGrossWeight;
	private Double	          totalMeasurement;
	private Double	          realTotalGrossWeight;

	public String getNo() {
		return ProjectUtils.getPackingNo(getObjectId());
	}

	/**
	 * @return the blNo
	 */
	public String getBlNo() {
		return blNo;
	}

	/**
	 * @param blNo
	 *            the blNo to set
	 */
	public void setBlNo(String blNo) {
		this.blNo = blNo;
	}

	/**
	 * @return the remark
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @param remark
	 *            the remark to set
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return the type
	 */
	public Integer getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(Integer type) {
		this.type = type;
	}

	/**
	 * @return the packingItems
	 */
	public List<PackingItem> getPackingItems() {
		return packingItems;
	}

	/**
	 * @param packingItems
	 *            the packingItems to set
	 */
	public void setPackingItems(List<PackingItem> packingItems) {
		this.packingItems = packingItems;
	}

	/**
	 * @return the status
	 */
	public Integer getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(Integer status) {
		this.status = status;
	}

	/**
	 * @return the totalQuantity
	 */
	public Double getTotalQuantity() {
		return totalQuantity;
	}

	/**
	 * @param totalQuantity
	 *            the totalQuantity to set
	 */
	public void setTotalQuantity(Double totalQuantity) {
		this.totalQuantity = totalQuantity;
	}

	/**
	 * @return the totalPackages
	 */
	public Integer getTotalPackages() {
		return totalPackages;
	}

	/**
	 * @param totalPackages
	 *            the totalPackages to set
	 */
	public void setTotalPackages(Integer totalPackages) {
		this.totalPackages = totalPackages;
	}

	/**
	 * @return the totalNetWeight
	 */
	public Double getTotalNetWeight() {
		return totalNetWeight;
	}

	/**
	 * @param totalNetWeight
	 *            the totalNetWeight to set
	 */
	public void setTotalNetWeight(Double totalNetWeight) {
		this.totalNetWeight = totalNetWeight;
	}

	/**
	 * @return the totalGrossWeight
	 */
	public Double getTotalGrossWeight() {
		return totalGrossWeight;
	}

	/**
	 * @param totalGrossWeight
	 *            the totalGrossWeight to set
	 */
	public void setTotalGrossWeight(Double totalGrossWeight) {
		this.totalGrossWeight = totalGrossWeight;
	}

	/**
	 * @return the totalMeasurement
	 */
	public Double getTotalMeasurement() {
		return totalMeasurement;
	}

	/**
	 * @param totalMeasurement
	 *            the totalMeasurement to set
	 */
	public void setTotalMeasurement(Double totalMeasurement) {
		this.totalMeasurement = totalMeasurement;
	}

	public String getByOthers() {
		return byOthers;
	}

	public void setByOthers(String byOthers) {
		this.byOthers = byOthers;
	}

	public String getShipName() {
		return shipName;
	}

	public void setShipName(String shipName) {
		this.shipName = shipName;
	}

	public Date getEta() {
		return eta;
	}

	public void setEta(Date eta) {
		this.eta = eta;
	}

	public String getSealNo() {
		return sealNo;
	}

	public void setSealNo(String sealNo) {
		this.sealNo = sealNo;
	}

	public String getContainerNo() {
		return containerNo;
	}

	public void setContainerNo(String containerNo) {
		this.containerNo = containerNo;
	}

	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public Integer getCommercialInvoiceId() {
		return commercialInvoiceId;
	}

	public void setCommercialInvoiceId(Integer commercialInvoiceId) {
		this.commercialInvoiceId = commercialInvoiceId;
	}

	public String getCommercialInvoiceNo() {
		if (commercialInvoiceId != null) {
			return ProjectUtils.getCommercialInvoiceNo(commercialInvoiceId);
		}
		return "";
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String getCustomerNo() {
		return ProjectUtils.getCustomerNo(customerId);
	}

	public String getOrderIds() {
		return orderIds;
	}

	public void setOrderIds(String orderIds) {
		this.orderIds = orderIds;
	}

	public Date getPackingDate() {
		return packingDate;
	}

	public void setPackingDate(Date packingDate) {
		this.packingDate = packingDate;
	}

	public Double getRealTotalGrossWeight() {
		return realTotalGrossWeight;
	}

	public void setRealTotalGrossWeight(Double realTotalGrossWeight) {
		this.realTotalGrossWeight = realTotalGrossWeight;
	}
}
